package com.wedu.modules.dss.controller;

import com.wedu.common.utils.PageUtils;
import com.wedu.common.utils.R;
import com.wedu.modules.dss.entity.DeviceInformationEntity;
import com.wedu.modules.dss.entity.MaintenanceRecordsEntity;
import com.wedu.modules.dss.service.DeviceInformationService;
import com.wedu.modules.sys.controller.AbstractController;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Date;
import java.util.Map;

@RestController
@RequestMapping("dss/maintenanceWarning")
public class DeviceInformationController extends AbstractController {

    @Autowired
    private DeviceInformationService deviceInformationService;


    /**
     * 查看*/
    @GetMapping("/list")
    @RequiresPermissions("dss:warning:list")
    public R list(@RequestParam Map<String,Object> map){
        PageUtils pageUtils = deviceInformationService.queryPageWarning(map);
        return R.ok().put("page", pageUtils);
    }

    /**
     * 按钮：点击保养状态更新为保养中*/
    @PostMapping("/maintenance")
    @RequiresPermissions("dss:warning:maintenance")
    public R maintenance(@RequestBody Long[] ids){

        deviceInformationService.maintenance(ids,getUserId());
        return R.ok();
    }
}
